<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>策略模式</title>
  </head>
  <body>
    <h2>策略模式</h2>

    <script src="./index.js"></script>

    <script>
      // var performanceS = function() {};
      // performanceS.prototype.calculate = function(salary) {
      //   return salary * 4;
      // };

      // var Bonus = function() {
      //   this.salary = null;
      //   this.strategy = null;
      // };
      // Bonus.prototype.setSalary = function(salary) {
      //   this.salary = salary;
      // };
      // Bonus.prototype.setStrategy = function(strategy) {
      //   this.strategy = strategy;
      // };
      // Bonus.prototype.getBonus = function() {
      //   return this.strategy.calculate(this.salary);
      // };
      // var myBonus = new Bonus();
      // myBonus.setSalary(20000);
      // myBonus.setStrategy(new performanceS());
      // console.log(myBonus.getBonus()); // 80000
    </script>
  </body>
</html>
